<!--
 * @Author: your name
 * @Date: 2022-03-02 09:56:43
 * @LastEditTime: 2022-04-15 14:23:42
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \trace-source-web\src\views\trace-source-manage\components\productionTraceability\components\subject-information.vue
-->
<template>
  <!-- 产量信息 -->
  <el-card v-if="!yaofeiStatus" id="production-record" class="box-card">
    <div slot="header" class="clearfix">
      <span>产量记录 PRODUCTION RECORD</span>
    </div>
    <div class="base-zh-box zh-table">
      <div class="zh-box-table agri">
        <el-table
          ref="tableData"
          v-loading="loading"
          highlight-current-row
          :data="yaofeiTableList"
          stripe
          border
        >
          <el-table-column type="index" label="序号" width="60" />
          <el-table-column prop="grade" label="品质等级" />
          <el-table-column prop="yield" label="产量">
            <template
              v-if="scope.row.grade"
              slot-scope="scope"
            >
              <span v-if="scope.row.yield">
                {{ scope.row.yield }}</span>
              <span v-if="scope.row.yield">
                {{ scope.row.unitName }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="yieldDate" label="收获日期" />
        </el-table>
      </div>
    </div>
  </el-card>
</template>

<script>
import graApi from "@/api/trace-source-web/production-api/index-primary.js"
export default {
  props: {
    batId: {
      type: [String, Number],
      default: () => ('')
    },
    startTime: {
      type: [Number, String],
      default: () => ('')
    },
    endTime: {
      type: [Number, String],
      default: () => ('')
    }
  },
  data() {
    return {
      loading: false,
      yaofeiTableList: [],
      yaofeiStatus: true
    };
  },
  watch: {
    startTime: {
      handler(val) {
        this.getbatchinfo()
      }
    }
  },
  // mounted() {
  //   this.getbatchinfo()
  // },
  methods: {
    // 获取批次信息
    getbatchinfo() {
      let params = {
        batchNo: this.batId,
        startTime: this.startTime,
        endTime: this.endTime
      }
      graApi.queryReportForm(params).then(res => {
        this.yaofeiTableList = res.data || [];
        // console.log(this.yaofeiTableList)
        if (this.yaofeiTableList.length > 0) {
          this.yaofeiStatus = false
        } else {
          this.yaofeiStatus = true
        }
      })
    }
  }
};
</script>

<style lang="scss" scoped>
#production-record {
  .el-input {
    margin-left: 10px;
    width: 50%;
    ::v-deep .el-input__inner {
      border: 0;
      height: 25px;
      background-color: rgba($color: #0e4352, $alpha: 1);
      border-radius: 40px;
      text-align: center;
    }
  }
  ::v-deep .el-card__body {
    padding: 20px 10px;
    .el-row {
      padding: 0px;
      border-bottom: 1px solid rgba($color: #64b9d1, $alpha: 0.9);
      img {
        margin: 0 auto;
        width: 100%;
        height: 305px;
        // border-radius: 50%;
        box-sizing: content-box;
        border: 2px solid rgba($color: #184e5f, $alpha: 1);
      }
      p {
        margin-left: 20px;
      }
      ul {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        padding: 0;
        li {
          display: flex;
          list-style-type: none;
          margin: 0;
          width: 25%;
          line-height: 40px;
          justify-content: center;
          .el-input {
            margin-left: 10px;
            width: 60%;
            ::v-deep .el-input__inner {
              border: 0;
              height: 25px;
              background-color: rgba($color: #0e4352, $alpha: 1);
              border-radius: 40px;
              text-align: center;
            }
          }
        }
      }
      .el-col {
        .el-row {
          padding: 10px;
        }
        .left-right {
          border: none;
          border-right: 1px solid rgba($color: #64b9d1, $alpha: 0.9);
        }
        .left-top {
          border-right: 1px solid rgba($color: #64b9d1, $alpha: 0.9);
          //   height: 80px;
          ul {
            padding: 0;
            height: 120px;
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            justify-content: space-evenly;
            align-items: center;
            li {
              background-color: #0f4656;
              list-style-type: none;
              margin: 10px;
              height: 120px;
              width: 90px;
              display: flex;
              flex-direction: column;
              align-items: center;
              justify-content: space-around;
              i {
                font-size: 34px;
              }
            }
          }
        }
      }
    }

        .agri {
          display: block;
          .agri-page {
            position: relative;
            // width: 100%;
            height: 40px;
            .pagination {
              position: absolute;
              right: 0px;
              bottom: 2px !important;
              .el-pager,
              .el-pager li {
                display: inline-block !important;
              }
            }
          }
        }
    .honorary {
      width: 99%;
      height: 400px;
      margin: 10px 10px auto;
      box-sizing: border-box;
      display: flex;
      justify-content: space-around;
      background: #0f4656;
    }
  }
}

.zh-lable {
  width: 80px;
  white-space: nowrap;
  font-size: 16px;
}
.next {
  i {
    font-size: 100px;
    color: #fff;
  }
}
.prev {
  i {
    font-size: 100px;
    color: #fff;
  }
}

.prev:hover,
.next:hover {
  i {
    color: #409eff;
  }
}
// 跑马灯 过渡
::v-deep .el-carousel__item.is-in-stage{
  opacity: 1;
}
::v-deep .el-carousel__item {
  opacity: 0;
  transition: .5s;
}
</style>
